<template id="doudle_already_complete">
	<div class="doudle_already_complete">

		<div class="doudle_main" v-for="(item,index) in todos" :key="index">

			<div class="doudle_main_top"><img src="../../assets/images/my_order/my_order_15.png" /></div>
			<div class="doudle_main_dl">
				<div class="doudle_dl">
					<dl>
						
						<dt><img v-lazy="item.photo"/></dt>
						<dd>
							<p>{{item.coach_name}}</p>
							<p>{{item.class_name}}</p>
							<p>预约时间:{{item.create_time | formatDate}}</p>
						</dd>
						
					</dl>
				</div>
			</div>

			<div class="doudle_money">
				<div class="doudle_neth">
					<span>实付款: </span>
					<font>￥{{item.cash_price}}</font>
				</div>
			</div>

			<div class="doudle_detail">
				<div class="doudle_hear">
					<button>评价晒单</button>
					<button @click.stop="make(item.coachid)">再次预约</button>
				</div>
			</div>

		</div>

	</div>
</template>

<script>
	export default {
		data() {

			return {
				coachid: this.$route.query.coachid,
				todos: [],
			}

		},
		components: {},
		created() {
          alreadyComplete:{
         	//let SESSION_ID = JSON.parse(window.sessionStorage.getItem('SESSION_ID'));
			 var SESSION_ID=JSON.parse(window.localStorage.getItem('sessiond'))
				let obj = {
					//请求的参数
					userid: SESSION_ID.user.id,
					sessionid: SESSION_ID.sessionid,
					
					
				};
				let _this = this
				let qs = require('qs');
		this.$axios.post("/yujia/user/findUnEvaluateBookingByUserId", qs.stringify(obj), {
					headers: {
						'Content-Type': 'application/x-www-form-urlencoded'
					}
					//重写headers 请求头  qs.stringify(json对象) 把对象转化为字符串 
				}).then(function(response) {
					_this.todos = response.data.data;	
				}).catch(function(error) {
					console.log(error);
				});
         }
		},
		filters: {
			formatDate: function(value) {
				let date = new Date(value);
				let y = date.getFullYear();
				let MM = date.getMonth() + 1;
				MM = MM < 10 ? ('0' + MM) : MM;
				let d = date.getDate();
				d = d < 10 ? ('0' + d) : d;
				let h = date.getHours();
				h = h < 10 ? ('0' + h) : h;
				let m = date.getMinutes();
				m = m < 10 ? ('0' + m) : m;
				let s = date.getSeconds();
				s = s < 10 ? ('0' + s) : s;
				return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s;
			},
		},
		methods: {
			total(index) {
//				this.todos.splice(index, 1)
			},
			make(coachid){
				this.$router.push({
					path:'/appointment_coach',
					query:{
						coachid,
					}
				})
			}
		},

		computed: {

		}

	}
</script>

<style scoped>
	@import "../../assets/css/doudle_already_complete.css";
</style>